#include <iostream>

using namespace std;
const int maxLen = 10;
const int maxColor = 4;

//检查当前位置颜色是否合法
int check(int map[maxLen][maxLen], int color[maxLen], int i)
{
    for (int j = 0; j < i; j++)
    {
        if (map[i][j] == 1)
        {
            if (color[i] == color[j])
            {
                return 0;
            }
        }
    }

    return 1;
}

int main()
{
    int n, m;
    int map[maxLen][maxLen];
    int color[maxLen];

    cin >> n >> m;
    int i, j, k;
    for (i = 0; i < n; i++)
    {
        color[i] = 0;
        for (j = 0; j < n; j++)
        {
            map[i][j] = 0;
        }
    }
    for (k = 0; k < m; k++)
    {
        cin >> i >> j;
        map[i - 1][j - 1] = 1;
        map[j - 1][i - 1] = 1;
    }

    int ans = 0;

    i = 0;
    while (color[0] < maxColor)
    {
        int flag = check(map, color, i);
        if (flag)
        {
            //搜索完毕 进行下一个解的搜索
            if (i == n - 1)
            {
                ans++;
                color[i]++;
            }
            else
            {
                i++;
            }
        }
        else
        {
            color[i]++;
        }

        //循环进位
        while (color[i] >= maxColor)
        {
            color[i] = 0;
            i--;
            if (i < 0)
            {
                break;
            }
            color[i]++;
        }
        if (i < 0)
        {
            break;
        }
    }

    cout << ans;

    return 0;
}